<html>

<head>

<title>RStudio: Keyboard Shortcuts</title>

<link rel="stylesheet" href="../rstudio.css" type="text/css"/>

<style type="text/css">
#banner {
  margin-bottom: 0px;
}
.shortcuts th {
  text-align: left;
  padding-right: 20px;
}
.shortcuts, .shortcuts td {
  font-size: 10pt;
  padding-right: 20px;
}
</style>

</head>

<body>

<h3 id="banner"><img src="../images/rstudio.png" width="73" height="17" title="RStudio"/></h3>

<div style="margin-left: 20px; margin-right: 20px">

<h2>Keyboard Shortcuts</h2>

<style type='text/css'> 
  .shortcuts td, .shortcuts th {
    padding-left: 1.6em;
    padding-bottom: 0.5em; }
</style> 
<table class='shortcuts'>
  <tr><td colspan="3"><h3>Console</h3></td></tr><tr><th>Description</th><th>Windows &amp; Linux</th><th>Mac</th></tr>
  <tr>
    <td>Move cursor to Console</td>
    <td>Ctrl+2</td>
    <td>Ctrl+2</td>
  </tr>
  <tr>
    <td>Clear console</td>
    <td>Ctrl+L</td>
    <td>Ctrl+L</td>
  </tr>
  <tr>
    <td>Move cursor to beginning of line</td>
    <td>Home</td>
    <td>Command+Left</td>
  </tr>
  <tr>
    <td>Move cursor to end of line</td>
    <td>End</td>
    <td>Command+Right</td>
  </tr>
  <tr>
    <td>Navigate command history</td>
    <td>Up/Down</td>
    <td>Up/Down</td>
  </tr>
  <tr>
    <td>Popup command history</td>
    <td>Ctrl+Up</td>
    <td>Command+Up</td>
  </tr>
  <tr>
    <td>Interrupt currently executing command</td>
    <td>Esc</td>
    <td>Esc</td>
  </tr>
  <tr>
    <td>Change working directory</td>
    <td>Ctrl+Shift+H</td>
    <td>Ctrl+Shift+H</td>
  </tr>
  <tr><td><br/></td></tr>
  <tr><td colspan="3"><h3>Source</h3></td></tr><tr><th>Description</th><th>Windows &amp; Linux</th><th>Mac</th></tr>
   <tr>
    <td>Goto File/Function</td>
    <td>Ctrl+.</td>
    <td>Ctrl+.</td>
  </tr>
  <tr>
    <td>Move cursor to Source Editor</td>
    <td>Ctrl+1</td>
    <td>Ctrl+1</td>
  </tr>
  <tr>
    <td>New document (except on Chrome/Windows)</td>
    <td>Ctrl+Shift+N</td>
    <td>Command+Shift+N</td>
  </tr>
  <tr>
    <td>New document (Chrome only)</td>
    <td>Ctrl+Alt+Shift+N</td>
    <td>Command+Shift+Alt+N</td>
  </tr>
  <tr>
    <td>Open document</td>
    <td>Ctrl+O</td>
    <td>Command+O</td>
  </tr>
  <tr>
    <td>Save active document</td>
    <td>Ctrl+S</td>
    <td>Command+S</td>
  </tr>
  <tr>
    <td>Close active document (except on Chrome)</td>
    <td>Ctrl+W</td>
    <td>Command+W</td>
  </tr>
  <tr>
    <td>Close active document (Chrome only)</td>
    <td>Ctrl+Alt+W</td>
    <td>Command+Option+W</td>
  </tr>
  <tr>
     <td>Close all open documents</td>
     <td>Ctrl+Shift+W</td>
     <td>Command+Shift+W</td>
   </tr>
  <tr>
    <td>Preview HTML (Markdown and HTML)</td>
    <td>Ctrl+Shift+K</td>
    <td>Command+Shift+K</td>
  </tr>
  <tr>
    <td>Knit Document (knitr)</td>
    <td>Ctrl+Shift+K</td>
    <td>Command+Shift+K</td>
  </tr>
  <tr>
    <td>Compile Notebook</td>
    <td>Ctrl+Shift+K</td>
    <td>Command+Shift+K</td>
  </tr>
  <tr>
    <td>Compile PDF (TeX and Sweave)</td>
    <td>Ctrl+Shift+K</td>
    <td>Command+Shift+K</td>
  </tr>
  <tr>
    <td>Insert chunk (Sweave and Knitr)</td>
    <td>Ctrl+Alt+I</td>
    <td>Command+Option+I</td>
  </tr>
  <tr>
    <td>Insert code section</td>
    <td>Ctrl+Shift+R</td>
    <td>Command+Shift+R</td>
  </tr>
  <tr>
    <td>Run current line/selection</td>
    <td>Ctrl+Enter</td>
    <td>Command+Enter</td>
  </tr>
  <tr>
    <td>Run current line/selection (retain cursor position)</td>
    <td>Alt+Enter</td>
    <td>Option+Enter</td>
  </tr>
  <tr>
    <td>Re-run previous region</td>
    <td>Ctrl+Shift+P</td>
    <td>Command+Shift+P</td>
  </tr>
  <tr>
    <td>Run current document</td>
    <td>Ctrl+Alt+R</td>
    <td>Command+Option+R</td>
  </tr>
  <tr>
    <td>Run from document beginning to current line</td>
    <td>Ctrl+Alt+B</td>
    <td>Command+Option+B</td>
  </tr>
  <tr>
    <td>Run from current line to document end</td>
    <td>Ctrl+Alt+E</td>
    <td>Command+Option+E</td>
  </tr>
  <tr>
    <td>Run the current function definition</td>
    <td>Ctrl+Alt+F</td>
    <td>Command+Option+F</td>
  </tr>
  <tr>
    <td>Run the current code section</td>
    <td>Ctrl+Alt+T</td>
    <td>Command+Option+T</td>
  </tr>
  <tr>
    <td>Run previous Sweave/Rmd code</td>
    <td>Ctrl+Alt+P</td>
    <td>Command+Option+P</td>
  </tr>
  <tr>
    <td>Run the current Sweave/Rmd chunk</td>
    <td>Ctrl+Alt+C</td>
    <td>Command+Option+C</td>
  </tr>
  <tr>
    <td>Run the next Sweave/Rmd chunk</td>
    <td>Ctrl+Alt+N</td>
    <td>Command+Option+N</td>
  </tr>
  <tr>
    <td>Source a file</td>
    <td>Ctrl+Shift+O</td>
    <td>Command+Shift+O</td>
  </tr>
  <tr>
    <td>Source the current document</td>
    <td>Ctrl+Shift+S</td>
    <td>Command+Shift+S</td>
  </tr>
  <tr>
    <td>Source the current document (with echo)</td>
    <td>Ctrl+Shift+Enter</td>
    <td>Command+Shift+Enter</td>
  </tr>
  <tr>
     <td>Fold Selected</td>
     <td>Alt+L</td>
     <td>Cmd+Option+L</td>
   </tr>
  <tr>
     <td>Unfold Selected</td>
     <td>Shift+Alt+L</td>
     <td>Cmd+Shift+Option+L</td>
   </tr>
  <tr>
     <td>Fold All</td>
     <td>Alt+O</td>
     <td>Cmd+Option+O</td>
   </tr>
  <tr>
     <td>Unfold All</td>
     <td>Shift+Alt+O</td>
     <td>Cmd+Shift+Option+O</td>
   </tr>
  <tr>
     <td>Go to line</td>
     <td>Shift+Alt+G</td>
     <td>Cmd+Shift+Option+G</td>
   </tr>
  <tr>
    <td>Jump to</td>
    <td>Shift+Alt+J</td>
    <td>Cmd+Shift+Option+J</td>
  </tr>
  <tr>
    <td>Switch to tab</td>
    <td>Ctrl+Shift+.</td>
    <td>Ctrl+Shift+.</td>
  </tr>
  <tr>
    <td>Previous tab</td>
    <td>Ctrl+F11</td>
    <td>Ctrl+F11</td>
  </tr>
  <tr>
    <td>Next tab</td>
    <td>Ctrl+F12</td>
    <td>Ctrl+F12</td>
  </tr>
  <tr>
    <td>First tab</td>
    <td>Ctrl+Shift+F11</td>
    <td>Ctrl+Shift+F11</td>
  </tr>
  <tr>
    <td>Last tab</td>
    <td>Ctrl+Shift+F12</td>
    <td>Ctrl+Shift+F12</td>
  </tr>
  <tr>
     <td>Navigate back</td>
     <td>Ctrl+F9</td>
     <td>Cmd+F9</td>
  </tr>
  <tr>
     <td>Navigate forward</td>
     <td>Ctrl+F10</td>
     <td>Cmd+F10</td>
  </tr>
  <tr>
    <td>Extract function from selection</td>
    <td>Ctrl+Alt+X</td>
    <td>Command+Option+X</td>
  </tr>
  <tr>
    <td>Extract variable from selection</td>
    <td>Ctrl+Alt+V</td>
    <td>Command+Option+V</td>
  </tr>
  <tr>
     <td>Reindent lines</td>
     <td>Ctrl+I</td>
     <td>Command+I</td>
   </tr>
  <tr>
    <td>Comment/uncomment current line/selection</td>
    <td>Ctrl+Shift+C</td>
    <td>Command+Shift+C</td>
  </tr>
  <tr>
     <td>Reflow Comment</td>
     <td>Ctrl+Shift+/</td>
     <td>Command+Shift+/</td>
   </tr>
  <tr>
    <td>Reformat Selection</td>
    <td>Ctrl+Shift+A</td>
    <td>Command+Shift+A</td>
  </tr>
  <tr>
    <td>Show Diagnostics</td>
    <td>Ctrl+Shift+Alt+P</td>
    <td>Command+Shift+Alt+P</td>
  </tr>
  <tr>
    <td>Transpose Letters</td>
    <td></td>
    <td>Ctrl+T</td>
  </tr>
  <tr>
    <td>Move Lines Up/Down</td>
    <td>Alt+Up/Down</td>
    <td>Option+Up/Down</td>
  </tr>
  <tr>
    <td>Copy Lines Up/Down</td>
    <td>Shift+Alt+Up/Down</td>
    <td>Command+Option+Up/Down</td>
  </tr>
  <tr>
    <td>Jump to Matching Brace/Paren</td>
    <td>Ctrl+P</td>
    <td>Ctrl+P</td>
  </tr>
  <tr>
    <td>Expand to Matching Brace/Paren</td>
    <td>Ctrl+Shift+E</td>
    <td>Ctrl+Shift+E</td>
  </tr>
  <tr>
    <td>Select to Matching Brace/Paren</td>
    <td>Ctrl+Shift+Alt+E</td>
    <td>Ctrl+Shift+Alt+E</td>
  </tr>
  <tr>
    <td>Add Cursor Above Current Cursor</td>
    <td>Ctrl+Alt+Up</td>
    <td>Ctrl+Alt+Up</td>
  </tr>
  <tr>
    <td>Add Cursor Below Current Cursor</td>
    <td>Ctrl+Alt+Down</td>
    <td>Ctrl+Alt+Down</td>
  </tr>
  <tr>
    <td>Move Active Cursor Up</td>
    <td>Ctrl+Alt+Shift+Up</td>
    <td>Ctrl+Alt+Shift+Up</td>
  </tr>
  <tr>
    <td>Move Active Cursor Down</td>
    <td>Ctrl+Alt+Shift+Down</td>
    <td>Ctrl+Alt+Shift+Down</td>
  </tr>
  <tr>
    <td>Find and Replace</td>
    <td>Ctrl+F</td>
    <td>Command+F</td>
  </tr>
  <tr>
    <td>Find Next</td>
    <td>Win: F3, Linux: Ctrl+G</td>
    <td>Command+G</td>
  </tr>
  <tr>
    <td>Find Previous</td>
    <td>Win: Shift+F3, Linux: Ctrl+Shift+G</td>
    <td>Command+Shift+G</td>
  </tr>
  <tr>
    <td>Use Selection for Find</td>
    <td>Ctrl+F3</td>
    <td>Command+E</td>
  </tr>
  <tr>
    <td>Replace and Find</td>
    <td>Ctrl+Shift+J</td>
    <td>Command+Shift+J</td>
  </tr>
  <tr>
    <td>Find in Files</td>
    <td>Ctrl+Shift+F</td>
    <td>Command+Shift+F</td>
  </tr>
  <tr>
    <td>Check Spelling</td>
    <td>F7</td>
    <td>F7</td>
  </tr>
  <tr><td><br/></td></tr>
  <tr><td colspan="3"><h3>Editing (Console and Source)</h3></td></tr><tr><th>Description</th><th>Windows &amp; Linux</th><th>Mac</th></tr>
  <tr>
    <td>Undo</td>
    <td>Ctrl+Z</td>
    <td>Command+Z</td>
  </tr>
  <tr>
    <td>Redo</td>
    <td>Ctrl+Shift+Z</td>
    <td>Command+Shift+Z</td>
  </tr>
  <tr>
    <td>Cut</td>
    <td>Ctrl+X</td>
    <td>Command+X</td>
  </tr>
  <tr>
    <td>Copy</td>
    <td>Ctrl+C</td>
    <td>Command+C</td>
  </tr>
  <tr>
    <td>Paste</td>
    <td>Ctrl+V</td>
    <td>Command+V</td>
  </tr>
  <tr>
    <td>Select All</td>
    <td>Ctrl+A</td>
    <td>Command+A</td>
  </tr>
  <tr>
    <td>Jump to Word</td>
    <td>Ctrl+Left/Right</td>
    <td>Option+Left/Right</td>
  </tr>
  <tr>
    <td>Jump to Start/End</td>
    <td>Ctrl+Home/End or Ctrl+Up/Down</td>
    <td>Command+Home/End or Command+Up/Down</td>
  </tr>
  <tr>
    <td>Delete Line</td>
    <td>Ctrl+D</td>
    <td>Command+D</td>
  </tr>
  <tr>
    <td>Select</td>
    <td>Shift+[Arrow]</td>
    <td>Shift+[Arrow]</td>
  </tr>
  <tr>
    <td>Select Word</td>
    <td>Ctrl+Shift+Left/Right</td>
    <td>Option+Shift+Left/Right</td>
  </tr>
  <tr>
    <td>Select to Line Start</td>
    <td>Alt+Shift+Left</td>
    <td>Command+Shift+Left</td>
  </tr>
  <tr>
    <td>Select to Line End</td>
    <td>Alt+Shift+Right</td>
    <td>Command+Shift+Right</td>
  </tr>
  <tr>
    <td>Select Page Up/Down</td>
    <td>Shift+PageUp/PageDown</td>
    <td>Shift+PageUp/Down</td>
  </tr>
  <tr>
    <td>Select to Start/End</td>
    <td>Ctrl+Shift+Home/End or Shift+Alt+Up/Down</td>
    <td>Command+Shift+Up/Down</td>
  </tr>
  <tr>
    <td>Delete Word Left</td>
    <td>Ctrl+Backspace</td>
    <td>Option+Backspace or Ctrl+Option+Backspace</td>
  </tr>
  <tr>
    <td>Delete Word Right</td>
    <td></td>
    <td>Option+Delete</td>
  </tr>
  <tr>
    <td>Delete to Line End</td>
    <td></td>
    <td>Ctrl+K</td>
  </tr>
  <tr>
    <td>Delete to Line Start</td>
    <td></td>
    <td>Option+Backspace</td>
  </tr>
  <tr>
    <td>Indent</td>
    <td>Tab (at beginning of line)</td>
    <td>Tab (at beginning of line)</td>
  </tr>
  <tr>
    <td>Outdent</td>
    <td>Shift+Tab</td>
    <td>Shift+Tab</td>
  </tr>
  <tr>
    <td>Yank line up to cursor</td>
    <td>Ctrl+U</td>
    <td>Ctrl+U</td>
  </tr>
  <tr>
    <td>Yank line after cursor</td>
    <td>Ctrl+K</td>
    <td>Ctrl+K</td>
  </tr>
  <tr>
    <td>Insert currently yanked text</td>
    <td>Ctrl+Y</td>
    <td>Ctrl+Y</td>
  </tr>
  <tr>
    <td>Insert assignment operator</td>
    <td>Alt+-</td>
    <td>Option+-</td>
  </tr>
  <tr>
    <td>Insert pipe operator</td>
    <td>Ctrl+Shift+M</td>
    <td>Cmd+Shift+M</td>
  </tr>
  <tr>
    <td>Show help for function at cursor</td>
    <td>F1</td>
    <td>F1</td>
  </tr>
  <tr>
    <td>Show source code for function at cursor</td>
    <td>F2</td>
    <td>F2</td>
  </tr>
  <tr>
    <td>Find usages for symbol at cursor (C++)</td>
    <td>Ctrl+Alt+U</td>
    <td>Cmd+Option+U</td>
  </tr>
  <tr><td><br/></td></tr>
  <tr><td colspan="3"><h3>Completions (Console and Source)</h3></td></tr><tr><th>Description</th><th>Windows &amp; Linux</th><th>Mac</th></tr>
  <tr>
    <td>Attempt completion</td>
    <td>Tab or Ctrl+Space</td>
    <td>Tab or Command+Space</td>
  </tr>
  <tr>
    <td>Navigate candidates</td>
    <td>Up/Down</td>
    <td>Up/Down</td>
  </tr>
  <tr>
    <td>Accept selected candidate</td>
    <td>Enter, Tab, or Right</td>
    <td>Enter, Tab, or Right</td>
  </tr>
  <tr>
    <td>Dismiss completion popup</td>
    <td>Esc</td>
    <td>Esc</td>
  </tr>
  <tr><td><br/></td></tr>
  <tr><td colspan="3"><h3>Views</h3></td></tr><tr><th>Description</th><th>Windows &amp; Linux</th><th>Mac</th></tr>
  <tr>
    <td>Move focus to Source Editor</td>
    <td>Ctrl+1</td>
    <td>Ctrl+1</td>
  </tr>
  <tr>
    <td>Move focus to Console</td>
    <td>Ctrl+2</td>
    <td>Ctrl+2</td>
  </tr>
  <tr>
    <td>Move focus to Help</td>
    <td>Ctrl+3</td>
    <td>Ctrl+3</td>
  </tr>
  <tr>
    <td>Show History</td>
    <td>Ctrl+4</td>
    <td>Ctrl+4</td>
  </tr>
  <tr>
    <td>Show Files</td>
    <td>Ctrl+5</td>
    <td>Ctrl+5</td>
  </tr>
  <tr>
    <td>Show Plots</td>
    <td>Ctrl+6</td>
    <td>Ctrl+6</td>
  </tr>
  <tr>
    <td>Show Packages</td>
    <td>Ctrl+7</td>
    <td>Ctrl+7</td>
  </tr>
  <tr>
    <td>Show Environment</td>
    <td>Ctrl+8</td>
    <td>Ctrl+8</td>
  </tr>
  <tr>
    <td>Show Git/SVN</td>
    <td>Ctrl+9</td>
    <td>Ctrl+9</td>
  </tr>
  <tr>
    <td>Show Build</td>
    <td>Ctrl+0</td>
    <td>Ctrl+0</td>
  </tr>
  <tr>
    <td>Sync Editor &amp; PDF Preview</td>
    <td>Ctrl+F8</td>
    <td>Cmd+F8</td>
  </tr>
  <tr>
    <td>Show Keyboard Shortcut Reference</td>
    <td>Alt+Shift+K</td>
    <td>Option+Shift+K</td>
  </tr>
  <tr><td><br/></td></tr>
  
  <tr><td colspan="3"><h3>Build</h3></td></tr><tr><th>Description</th><th>Windows &amp; Linux</th><th>Mac</th></tr>
  <tr>
    <td>Build and Reload</td>
    <td>Ctrl+Shift+B</td>
    <td>Cmd+Shift+B</td>
  </tr>
  <tr>
    <td>Load All (devtools)</td>
    <td>Ctrl+Shift+L</td>
    <td>Cmd+Shift+L</td>
  </tr>
  <tr>
    <td>Test Package (Desktop)</td>
    <td>Ctrl+Shift+T</td>
    <td>Cmd+Shift+T</td>
  </tr>
  <tr>
    <td>Test Package (Web)</td>
    <td>Ctrl+Alt+F7</td>
    <td>Cmd+Alt+F7</td>
  </tr>
  <tr>
    <td>Check Package</td>
    <td>Ctrl+Shift+E</td>
    <td>Cmd+Shift+E</td>
  </tr>
  <tr>
    <td>Document Package</td>
    <td>Ctrl+Shift+D</td>
    <td>Cmd+Shift+D</td>
  </tr>
  <tr><td><br/></td></tr>

  <tr><td colspan="3"><h3>Debug</h3></td></tr><tr><th>Description</th><th>Windows &amp; Linux</th><th>Mac</th></tr>
  <tr>
   <td>Toggle Breakpoint</td>
   <td>Shift+F9</td>
   <td>Shift+F9</td>
  </tr>   
  <tr>
   <td>Execute Next Line</td>
   <td>F10</td>
   <td>F10</td>
  </tr> 
  <tr>
   <td>Step Into Function</td>
   <td>Shift+F4</td>
   <td>Shift+F4</td>
  </tr> 
  <tr>
   <td>Finish Function/Loop</td>
   <td>Shift+F6</td>
   <td>Shift+F6</td>
  </tr>     
  <tr>
   <td>Continue</td>
   <td>Shift+F5</td>
   <td>Shift+F5</td>
  </tr>   
  <tr>
   <td>Stop Debugging</td>
   <td>Shift+F8</td>
   <td>Shift+F8</td>
  </tr>   
  <tr><td><br/></td></tr>

  <tr><td colspan="3"><h3>Plots</h3></td></tr><tr><th>Description</th><th>Windows &amp; Linux</th><th>Mac</th></tr>
  <tr>
    <td>Previous plot</td>
    <td>Ctrl+Alt+F11</td>
    <td>Command+Option+F11</td>
  </tr>
  <tr>
    <td>Next plot</td>
    <td>Ctrl+Alt+F12</td>
    <td>Command+Option+F12</td>
  </tr>
  <tr><td><br/></td></tr>
  <tr><td colspan="3"><h3>Git/SVN</h3></td></tr><tr><th>Description</th><th>Windows &amp; Linux</th><th>Mac</th></tr>
  <tr>
    <td>Diff active source document</td>
    <td>Ctrl+Alt+D</td>
    <td>Ctrl+Option+D</td>
  </tr>
  <tr>
    <td>Commit changes</td>
    <td>Ctrl+Alt+M</td>
    <td>Ctrl+Option+M</td>
  </tr>
  <tr>
    <td>Scroll diff view</td>
    <td>Ctrl+Up/Down</td>
    <td>Ctrl+Up/Down</td>
  </tr>
  <tr>
    <td>Stage/Unstage (Git)</td>
    <td>Spacebar</td>
    <td>Spacebar</td>
  </tr>
  <tr>
    <td>Stage/Unstage and move to next (Git)</td>
    <td>Enter</td>
    <td>Enter</td>
  </tr>
  <tr><td><br/></td></tr>
  <tr><td colspan="3"><h3>Session</h3></td></tr><tr><th>Description</th><th>Windows &amp; Linux</th><th>Mac</th></tr>
  <tr>
    <td>Quit Session (desktop only)</td>
    <td>Ctrl+Q</td>
    <td>Command+Q</td>
  </tr>
  <tr>
    <td>Restart R Session</td>
    <td>Ctrl+Shift+F10</td>
    <td>Command+Shift+F10</td>
  </tr>
  <tr><td><br/></td></tr>
</table>
</div>
   
</body>
</html>
